package cn.com.bluemoon.daps.system.utils;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Supplier;

import static cn.hutool.core.bean.BeanUtil.copyProperties;

/**
 * @author ：zhym
 * @date ：Created in 2022/1/7 10:32
 * @description：
 */
public class BeanUtils {

    public static <S, T> List<T> copyListProperties(List<S> sources, Supplier<T> target) {
        if (sources == null || target == null) {
            return null;
        }
        List<T> list = new ArrayList<>(sources.size());
        for (S source : sources) {
            T t = target.get();
            copyProperties(source, t);
            list.add(t);
        }
        return list;
    }

}
